<!DOCTYPE html>
<!--
==========================================================================
云捷GO自动生成列表页面代码,只生成一次,按需修改.
生成日期：2021-07-09 11:02:15
生成路径: template/module/category/list.html
生成人：gfcms
==========================================================================
-->
<html lang="zh">
<head>
    {{template "header" (ossUrl)}}
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <p>栏目名称：</p>
                            <input type="text" name="catname"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            {{getPermiButton .Session.uid "module:category:add" "$.operate.add()" "新增" "btn btn-success" "fa fa-plus"}}
            {{getPermiButton .Session.uid "module:category:export" "$.table.exportExcel()" "导出" "btn btn-warning" "fa fa-download"}}
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-tree-table"></table>
        </div>
    </div>
</div>
{{template "footer" (ossUrl)}}
<script type="text/javascript">
    var addFlag = '{{hasPermi .Session.uid "module:category:add"}}';
    var editFlag = '{{hasPermi .Session.uid "module:category:edit"}}';
    var removeFlag = '{{hasPermi .Session.uid "module:category:remove"}}';
    var ismenuDatas = {{getDictTypeData "cate_show_hide"}};
    var prefix = ctx + "module/category";

    $(function () {
        var options = {
            type: 0,
            code: "id",
            parentCode: "parent_id",
            uniqueId: "id",
            expandAll: true,
            expandFirst: false,
            url: prefix + "/list",
            createUrl: prefix + "/add?pid={id}",
            updateUrl: prefix + "/edit?id={id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "产品栏目",
            columns: [{
                field: 'selectItem',
                radio: true
            },
                {
                    title: '菜单名称',
                    field: 'catname',
                    width: '20%',
                    formatter: function (value, row, index) {
                        if ($.common.isEmpty(row.icon)) {
                            return row.catname;
                        } else {
                            return '<i class="' + row.icon + '"></i> <span class="nav-label">' + row.catname + '</span>';
                        }
                    }
                },
                {
                    field: 'id',
                    title: '栏目Id',
                    width: '10%',
                    align: "left"
                },
                {
                    field: 'image',
                    title: '栏目图片',
                    width: '10%',
                    formatter: function (value, row, index) {
                        if ($.common.isEmpty(row.image)) {
                            return '';
                        } else {
                            return '<img style="max-width: 25%;" src="' + row.image + '">';
                        }
                    }
                },
                {
                    field: 'description',
                    width: '20%',
                    title: '描述'
                },
                {
                    field: 'ismenu',
                    width: '10%',
                    title: '是否导航栏显示',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(ismenuDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus"></i>新增</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.treeTable.init(options);
    });
</script>
</body>
</html>